package com.tmeone.erpone.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tmeone.erpone.entity.TStaff;
import com.tmeone.erpone.mapper.TStaffMapper;
import com.tmeone.erpone.service.ITStaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TStaffServiceImp extends ServiceImpl<TStaffMapper, TStaff> implements ITStaffService {

    @Autowired
    private  TStaffMapper tStaffMapper;
    @Override
    public IPage<TStaff> getPageTStaff(IPage<TStaff> page) {
        return tStaffMapper.pageStaff(page);
    }

    @Override
    public IPage<TStaff> getpageStaffTops(IPage<TStaff> page, String input, String dId) {
        //做判断
        if (input.equals("null")){
           return  tStaffMapper.pageStaffBydId(page,dId);
        }
        if (dId.equals("null")){
            return  tStaffMapper.pageStaffByName(page,input);
        }


        return tStaffMapper.pageStaffTops(page,input,dId);
    }

    @Override
    public IPage<TStaff> getPageQiYeToTStaff(Page<TStaff> tStaffPage, String qiYeToStaffId) {
        return tStaffMapper.pageQiYeToTStaff(tStaffPage,qiYeToStaffId);
    }

    @Override
    public List<TStaff> getStaffById(String id) {
        return tStaffMapper.getStaffById(id);
    }
}
